<script src='http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js'></script>
<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Positions/index')}">广告列表</a></li>
			<li class="active"><a href="{:U('Positions/add')}">添加广告位</a></li>
		</ul>
		<form method="post" class="form-horizontal" action="{:U('Positions/add_post')}">
			<fieldset>
				<div class="control-group">
					<label class="control-label">广告名称/备注</label>
					<div class="controls">
						<input type="text" name="name" value=""><span class="form-required">*</span>
					</div>
				</div>

				<div class="control-group">
					<label class="control-label">广告位置</label>
					<div class="controls">
						<select name="location" id="selecthref">
							<option value="-0">--请选择</option>
							<option value="1">首页轮播图</option>
							<option value="2">位置1</option>
							<option value="3">位置2</option>
							<option value="4">位置3</option>
						</select>
					</div>
				</div>

				<div class="control-group">
					<div class="controls">
						<div class="span3">
							<table class="table table-bordered">
								<tr>
									<th>广告图</th>
								</tr>
								<tr>
									<td>
										<div style="text-align: center;">
											<input type="hidden" name="img" id="thumb" value="">
											<a href="javascript:upload_one_image('图片上传','#thumb');">
												<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="thumb-preview" width="135" style="cursor: hand" />
											</a>
											<input type="button" class="btn btn-small" onclick="$('#thumb-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');$('#thumb').val('');return false;" value="取消图片">
										</div>
									</td>
								</tr>
							</table>
						</div>
					</div>
				</div>

				<div class="control-group">
					<label class="control-label">广告位置</label>
					<div class="controls">
						<span>PC端：</span>
						<input type="radio" checked="checked" name="type" value="2">
						<span>移动端：</span>
						<input type="radio" name="type" value="1">
					</div>
				</div>
				
			
			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:L('ADD')}</button>
				<a class="btn" href="javascript:history.back(-1);">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
<!-- 	<script>
		$(".file").change(function(){
			var a = $(this);
			var formData = new FormData();
			formData.append('file', $('.file')[0].files[0]);
			$.ajax({
			    url: "{:U('Api/Api/upload_photo')}",
			    type: 'POST',
			    cache: false,
			    data: formData,
			    processData: false,
			    contentType: false
			}).done(function(res) {

				$(a).parent('.controls').find('img').attr('src',res.src);
				$(a).parent('.controls').find('.hidden').val(res.src);
				$(a).parent('.controls').find('img').show();
				$(a).hide();

			}).fail(function(res) {

				alert('上传失败，请重新上传');

			});
		});
	</script> -->

</body>
</html>